package com.jinglin.controller;

import com.jinglin.service.DashboardService;
import com.jinglin.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/dashboard")
public class DashboardController {
    @Autowired
    private DashboardService dashboardService;

    @GetMapping("/siteInfo")
    public Result getSiteInfo(){
        Map<String, String> siteInfo = dashboardService.getSiteInfo();
        return Result.success(siteInfo);
    }
    @GetMapping("/articleCategorySize")
    public Result getArticleCategorySize(){
        return Result.success(dashboardService.getArticleCategorySize());
    }
    @GetMapping("/recentArticle")
    public Result getRecommendArticle() {

        return Result.success(dashboardService.getRecommendArticle(5));
    }
}
